﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DJY.Domain.ViewModel
{
    /// <summary>
    /// 编辑结果
    /// </summary>
    public class EditItemResult
    {
        public const string NOT_RIGHT_TAG = "NO_RIGHT";

        /// <summary>
        /// 操作结果
        /// </summary>
        public bool result { get; set; }

        /// <summary>
        /// 信息
        /// </summary>
        public string msg { get; set; }

        /// <summary>
        /// 说明
        /// </summary>
        public string tag { get; set; }

        /// <summary>
        /// 成功
        /// </summary>
        /// <param name="msg">消息</param>
        /// <param name="tag">标记</param>
        /// <returns></returns>
        public static EditItemResult Ok(string msg = null,string tag = null)
        {
            return new EditItemResult() { result = true, msg = msg, tag = tag };
        }

        /// <summary>
        /// 没有权限
        /// </summary>
        /// <returns></returns>
        public static EditItemResult NotRight()
        {
            return new EditItemResult() { result = false, msg = "没有操作权限", tag = NOT_RIGHT_TAG };
        }

        /// <summary>
        /// 失败
        /// </summary>
        /// <param name="msg">消息</param>
        /// <param name="tag">标记</param>
        /// <returns></returns>
        public static EditItemResult Fail(string msg = null, string tag = null)
        {
            return new EditItemResult() { result = false, msg = msg, tag = tag };
        }
    }
}
